import React, {Component} from 'react';
import './Message.css'

class Message extends Component {
  state = {
    headerIndex: 0,
    headerList: [
      {
        id: 1,
        title: '我寄的'
      },
      {
        id: 2,
        title: '我收的'
      },
      {
        id: 3,
        title: '批量订单'
      },
    ]
  };

  render() {
    return (
      <div>
        <h1>我的包裹</h1>
        <header id='header'>
          {this.state.headerList.map((item, index) => {
            return <div className={index === this.state.headerIndex ? "active" : ''}  key={item.id}
                        onClick={() => {
                          //改变数据
                          this.setState({
                            headerIndex: index
                          })
                        }}>
              {item.title}
            </div>
          })}
        </header>
        <main>

        </main>
      </div>
    );
  }

}


export default Message;
